﻿namespace UnitTestInjector
{
    #region Usings

    using System;

    #endregion Usings

    public abstract class DependenciesTestClass : BaseTestClass
    {
        private readonly IDependencyResolver dependencyResolver;

        protected DependenciesTestClass()
        {
            dependencyResolver = CreateDependencyResolver();
        }

        protected abstract IDependencyResolver CreateDependencyResolver();

        protected void AssertDependenciesIsResolvable<TDependency>() where TDependency : class
        {
            UnitTestInjectorAssert.IsNotNull(dependencyResolver.Resolve<TDependency>());
        }

        protected void AssertDependenciesIsResolvable<TDependency>(
            Func<IDependencyResolver, TDependency> resolveDependencyFunc)
        {
            UnitTestInjectorAssert.IsNotNull(resolveDependencyFunc(dependencyResolver));
        }
    }
}